// 预约
const sequelize = require('../config.js')
const { DataTypes } = require('sequelize')

const reservation = sequelize.define('reservation', {
	Id:{
		type: DataTypes.INTEGER,
		primaryKey: true,
		autoIncrement: true,
	},
	client_id: {
	  type: DataTypes.INTEGER,
	  allowNull: true,
	  references:{
		model: 'userinfos',
		key: 'user_id',
	  }
	//   unique: true
	//   comment: '用户ID'
	},
	merchant_id: {
	  type: DataTypes.INTEGER,
	  allowNull: true,
	  references:{
		model: 'userinfos',
		key: 'user_id',
	  }
	//   comment: '商户ID'
	},
	reservation_day:{
		type:DataTypes.STRING,
		comment:"预约日期"
	},
	reservation_start_date:{
		type:DataTypes.STRING,
		comment:'预约开始时间  H:m'
	},
	reservation_ent_date:{
		type:DataTypes.STRING,
		comment:'预约结束时间 H:m'
	},
	service_id:{
		type:DataTypes.STRING,
		comment:'产品服务ID',
	},
	consumption:{
		type:DataTypes.STRING,
		comment:'消费方式 1次卡  2优惠'
	},
	reservation_state:{
		type:DataTypes.STRING,
		comment:'状态'
	},
	pay_state:{
		type:DataTypes.INTEGER,
		comment:"支付状态 1 已支付 2待支付"
	}
  });
//   (async () => {
// 	await reservation.sync({alter:true});
//   })()

// module.exports = reservation